package com.engine;

import com.engine.utilities.MainGamePanel;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;

/**
 * User: cwatts
 * <p/>
 * Date: 12/29/11
 * <p/>
 * Engine is used to
 */
public class Engine
{
	private static final String TAG = Engine.class.getSimpleName();

	private MainGamePanel view;

	public Engine()
	{

	}

	public MainGamePanel getView()
	{
		return this.view;
	}

	public void Initialize(Context context)
	{
		this.view = new MainGamePanel(context, this);
	}

	public void Update()
	{
		//To change body of created methods use File | Settings | File Templates.
	}

	public void Render()
	{
		//To change body of created methods use File | Settings | File Templates.
	}

	public void HandleInput(MotionEvent event)
	{
		if (event.getAction() == MotionEvent.ACTION_DOWN)
		{
			if (event.getY() > this.view.getHeight() - 50)
			{
				this.view.setRunning(false);
				((Activity)this.view.getContext()).finish();
			}
			else
			{
				Log.d(TAG, "Coords: x=" + event.getX() + ", y=" + event.getY());
			}
		}
	}
}
